import http from "@/axios/index.js";
import { handleError, handleSuccess } from "@/utils/responseHandler.js";

export const AclApi = {

    createAcl: (data) => http.post('acl/create', data)
        .then(res => handleSuccess(res, '创建权限'))
        .catch(error => handleError(error, '创建权限', '创建权限失败')),

    updateAcl: (data) => http.put('acl/update', data)
        .then(res => handleSuccess(res, '更新权限'))
        .catch(error => handleError(error, '更新权限', '更新权限失败')),

    deleteAcl: (id) => http.delete(`acl/delete/${id}`)
        .then(res => handleSuccess(res, '删除权限'))
        .catch(error => handleError(error, '删除权限', '删除权限失败')),

    queryAcl: (name) => http.get(`acl/list?name=${name}`)
        .then(res => handleSuccess(res, '查询权限'))
        .catch(error => handleError(error, '查询权限', '查询权限失败')),

    getAclDetail:(id) => http.get(`acl/detail/${id}`)
        .then(res => handleSuccess(res, '查询权限详情'))
        .catch(error => handleError(error, '查询权限详情', '查询权限详情失败')),



}